<%@ page pageEncoding="UTF-8"%>
<%@ include file="../commons/head.jsp"%>
<style>
.datagrid-body {
	height: 290px !important;
}

.datagrid-view {
	height: 350px !important;
}

.datagrid-ftable {
	color: red;
}
</style>
<script type="text/javascript">
	var data;
	var flag = 0;
	var del = 0;
	$(function() {
		$('#tt')
				.datagrid(
						{
							rowStyler : function(index, row) {
								if (row.name != row.nameForCard) {
									if (index % 2 == 0) {
										return 'background-color:lightcyan;color:red;font-weight:bold;';
									} else {
										return 'color:red;font-weight:bold;';
									}
								} else {
									if (index % 2 == 0) {
										return 'background-color:lightcyan;';
									}
								}
							}
						});
		$.ajaxSetup({
			cache : false
		//关闭AJAX相应的缓存
		});

		//点击查询
		$("#search").click(function() {debugger
			debugger
			var params = {
				status : $("#status").combobox('getValue'),
				cellphone : $("#cellphone").val(),
				createTimeFrom : $("#createTimeFrom").datebox('getValue'),
				createTimeTo : $("#createTimeTo").datebox('getValue'),
				withdrawCashFrom : $("#withdrawCashFrom").val(),
				withdrawCashTo : $("#withdrawCashTo").val(),
				
			};
			$("#tt").datagrid('load', params);
			//datagrid取消选中方法： 
			$("#tt").datagrid("unselectAll");
		});

		//导出
		$("#export")
				.click(
						function() {
							var params = {
								status : $("#status").combobox('getValue'),
								cellphone : $("#cellphone").val(),
								createTimeFrom : $("#createTimeFrom").datebox(
										'getValue'),
								createTimeTo : $("#createTimeTo").datebox(
										'getValue'),
								withdrawCashFrom : $("#withdrawCashFrom").val(),
								withdrawCashTo : $("#withdrawCashTo").val(),
							};
							window.location.href = "${pageContext.request.contextPath}/remitSuc/export?cellphone="
									+ params.cellphone
									+ "&status="
									+ encodeURI(params.status)
									+ "&createTimeFrom="
									+ encodeURI(params.createTimeFrom)
									+ "&createTimeTo="
									+ encodeURI(params.createTimeTo)
									+ "&withdrawCashFrom="
									+ encodeURI(params.withdrawCashFrom)
									+ "&withdrawCashTo="
									+ encodeURI(params.withdrawCashTo);
						});

	});

	function reload() {
		$("#tt").datagrid('reload');
		//datagrid取消选中方法： 
		$("#tt").datagrid("unselectAll");
	};
	function rowStyle(index, row) {
		if (index % 2 == 0) {
			return 'background-color:lightcyan;';
		}
	}
	//日期格式化
	function gettime(val, row, index) {
		var m = "";
		if (val != null) {
			var s = val.substr(0, 10);
			var ss = val.substr(11, 8);
			var m = s;
		}
		return m;
	}

	//金额格式化
	function formatMoney(number) {

		number = Math.round(number * 100) / 100;
		return outputDollars(Math.floor(number - 0) + '')
				+ outputCents(number - 0);
	}
	function outputDollars(number) {
		if (number.length <= 3)
			return (number == '' ? '0' : number);
		else {
			var mod = number.length % 3;
			var output = (mod == 0 ? '' : (number.substring(0, mod)));
			for (i = 0; i < Math.floor(number.length / 3); i++) {
				if ((mod == 0) && (i == 0))
					output += number.substring(mod + 3 * i, mod + 3 * i + 3);
				else
					output += ','
							+ number.substring(mod + 3 * i, mod + 3 * i + 3);
			}
			return (output);
		}
	}
	function outputCents(amount) {
		amount = Math.round(((amount) - Math.floor(amount)) * 100);

		if (amount == 10 || amount == 20 || amount == 30 || amount == 40
				|| amount == 50 || amount == 60 || amount == 70 || amount == 80
				|| amount == 90) {
			amount = (amount.toString()).substr(0,
					(amount.toString()).length - 1);
			return '.' + amount;
		} else if (amount == 0) {
			return "";
		} else if (amount == 1 || amount == 2 || amount == 3 || amount == 4
				|| amount == 5 || amount == 6 || amount == 7 || amount == 8
				|| amount == 9) {
			return '.0' + amount;
		} else {
			return '.' + amount;
		}
	}
	//鼠标悬停显示提示
	function showTips(value, row, index) {
		var content = '';
		if (value != null && value != '') {
			if (value.length > 6 && strDateTime(value)) { //如果为时间
				value = value.substr(0, 10);
			}
			content = '<span title="' + value + '" class="note" >' + value
					+ '</span>';
		}
		return content;
	}
	function showMoneyTips(value, row, index) {
		var m = formatMoney(value, row, index);
		return showTips(m);
	}
	//判断是否为时间格式 yyyy-MM-dd HH:mm:ss
	function strDateTime(str) {
		var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;
		var r = str.match(reg);
		if (r == null)
			return false;
		var d = new Date(r[1], r[3] - 1, r[4], r[5], r[6], r[7]);
		return (d.getFullYear() == r[1] && (d.getMonth() + 1) == r[3]
				&& d.getDate() == r[4] && d.getHours() == r[5]
				&& d.getMinutes() == r[6] && d.getSeconds() == r[7]);
	}
</script>
<body>
	<div class="jianju">
		<h3>已打款</h3>
		<div class="panel datagrid easyui-fluid" style="width: 1135px;">
			<div class="datagrid-wrap panel-body panel-body-noheader" title=""
				style="width: 1135px;">
				<div id="tb" style="padding: 0px; height: auto"
					class="datagrid-toolbar">
					<div style="margin-bottom: 5px">
						<a id="export"
							href="#" class="easyui-linkbutton button l-btn l-btn-small"
							iconcls="icon-daochu" group="">导出<span
							class="l-btn-icon icon-daochu">&nbsp;</span></a>
					</div>
					<hr>
					<div>
						<label>会员手机号：</label><input id="cellphone"
							class="easyui-numberbox numberbox-f textbox-f"
							style="width: 100px; display: none;"> <label
							style="margin-left: 15px;">打款(拒绝)时间：</label><input
							id="createTimeFrom" type="text"
							class="easyui-datebox datebox-f combo-f textbox-f"
							editable="false" style="width: 110px; display: none;">~ <input
							id="createTimeTo" type="text"
							style="width: 110px; display: none;" editable="false"
							class="easyui-datebox datebox-f combo-f textbox-f"> <label
							style="margin-left: 15px;">申请金额：</label><input
							id="withdrawCashFrom" type="text"
							class="easyui-numberbox numberbox-f textbox-f"
							style="width: 100px; display: none;"> ~ <input
							id="withdrawCashTo" type="text"
							style="width: 100px; display: none;"
							class="easyui-numberbox numberbox-f textbox-f"> <label
							style="margin-left: 15px;">状态：</label> 
							<select id="status"
							class="easyui-combobox combobox-f combo-f textbox-f"
							style="width: 110px; display: none;" editable="false"
							panelheight="auto">
							<option value="">全部</option>
							<option value="3">已打款</option>
							<option value="4">已拒绝</option>
							</select> 
							<a id="search" href="#"
							class="easyui-linkbutton button l-btn l-btn-small"
							style="margin-left: 15px;" iconcls="icon-search" group="">查询<span
							class="l-btn-icon icon-search">&nbsp;</span></a>
					</div>
				</div>

				<table id="tt" class="easyui-datagrid datagrid-f"
					url="${pageContext.request.contextPath}/remitSuc/list" title=""
					style="display: none;" iconcls="icon-save" rownumbers="true"
					pagination="true" pagelist="[10,20,30,40]" method="get"
					toolbar="#tb" singleselect="false" checkonselect="true"
					selectoncheck="true" fitcolumns="true" idfield="id"
					showfooter="true" rowstyler="rowStyle"
					onloadsuccess:function(data){="" $(".note").tooltip({="" onshow:=""
					function(){="" $(this).tooltip('tip').css({="" width:'300',=""
					boxshadow:="" '1px="" 1px="" 3px=""#292929'="" });="" }="">
					<thead>
						<tr style="background: #148CCA;">
							<th data-options="field:'id',hidden:true" style="width: 1%">id</th>
							<th
								data-options="field:'orderNumber',align:'left',formatter:showTips"
								style="width: 14%">订单编号</th>
							<th data-options="field:'phone',align:'left',formatter:showTips"
								style="width: 10%">会员手机号</th>
							<th
								data-options="field:'payTime',align:'center',formatter:showTips"
								style="width: 14%">打款(拒绝)时间</th>
							<th data-options="field:'bankforCard',formatter:showTips"
								style="width: 10%">银行</th>
							<th
								data-options="field:'cardNumber',align:'center',formatter:showTips"
								style="width: 14%">卡号</th>
							<th data-options="field:'nameForCard',formatter:showTips"
								style="width: 8%">持卡人姓名</th>
							<th
								data-options="field:'cellphoneForCard',align:'center',formatter:showTips"
								style="width: 10%">预留手机号</th>
							<th
								data-options="field:'money',align:'right',formatter:formatMoney,formatter:showMoneyTips"
								style="width: 10%">申请金额</th>
							<th
								data-options="field:'statusText',align:'center',formatter:showTips"
								style="width: 8%">状态</th>
						</tr>
					</thead>
				</table>
			</div>
		</div>
	</div>
</body>